-
-
Notifications
You must be signed in to change notification settings - Fork 109
fix(zod): don't include @@validate rules when generating schema for validating update input #1625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… validating update input Fixes #1563
WalkthroughWalkthroughThe recent changes enhance the validation logic within the schema and testing framework, specifically regarding model relationships and updates. The conditional refinement of schemas has been simplified, leading to a more straightforward schema generation process. Additionally, integration tests have been updated to enforce stricter validation rules, ensuring references are correctly managed during both creation and updates. Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- packages/schema/src/plugins/zod/generator.ts (1 hunks)
- tests/integration/tests/enhancements/with-policy/field-validation.test.ts (2 hunks)
- tests/regression/tests/issue-1563.test.ts (1 hunks)
Additional comments not posted (4)
tests/regression/tests/issue-1563.test.ts (1)
1-30
: Test case for issue #1563 looks good.The test case is well-structured and verifies the intended fix for validation rules on reference properties during updates.
packages/schema/src/plugins/zod/generator.ts (1)
Line range hint
617-622
: Simplification of schema generation logic looks good.The removal of the conditional block for
refineFuncName
in theprismaUpdateSchema
simplifies the schema generation logic and ensures that the schema is no longer conditionally modified.tests/integration/tests/enhancements/with-policy/field-validation.test.ts (2)
649-651
: Enhancements to the update test case look good.The changes enhance the validation logic by ensuring that the
id
field is included in the data object and by restructuring theupdate
method calls to enforce stricter validation rules.
Line range hint
952-956
: Enhancements to the null comparison test case look good.The changes enhance the validation logic by ensuring that the
id
field is included in the data object and by restructuring theupdate
method calls to enforce stricter validation rules.
Fixes #1563